<style>
    .build-params .popover {
        max-width: 400px !important;
    }
    .projectName .popover {
        max-width: 400px !important;
    }
    .httpStatus .popover {
        max-width: 500px !important;
    }
</style>
<div class="modal-header">
    <h3 class="modal-title">
        <b style="color: #286090">持续集成模版配置</b>
    </h3>
</div>
<div class="modal-body">

    <form class="bs-example form-horizontal">

        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <!--<div style="font-size:1em;">&nbsp;</div>-->

            <div style="margin-top: 5px;" ng-show="templateItem.id == 0">
                <table class="table table-hover table-bordered table-striped">
                    <thead>
                    <tr>
                        <!--class="col-md-10"-->
                        <td>模版</td>
                        <td class="col-md-1">操作</td>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="template in templateList">
                        <td>
                            <a type="button" class="btn"
                               href="{{template.url}}" target="_blank"
                               style="background-color: #ff5f87; color: white;">{{template.name}}
                            </a>
                        </td>
                        <td>
                            <button ng-click="setTemplate(template)"
                                    class="btn btn-xs"
                                    style="margin-left: 20px; background-color: #2e6da4; color: white;">
                                <span class="glyphicon glyphicon-plus"></span>选择
                            </button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <div class="form-group">
                <div class="col-md-6">
                    <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>模版名称</label>
                    <div class="col-lg-8">
                        <input type="text" class="form-control" placeholder="在模版列表中选择" readonly required ng-model="templateItem.name">
                    </div>
                </div>

                <div class="col-md-6">
                    <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>模版版本</label>
                    <div class="col-lg-8">
                        <input type="text" class="form-control" placeholder="模版版本" required ng-model="templateItem.version">
                    </div>
                </div>
            </div>


            <div class="form-group">
                <div class="col-md-6">
                    <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>应用类型</label>
                    <div class="col-lg-8">
                        <!--required-->
                        <select class="form-control" ng-model="templateItem.appType"
                                ng-options="app.code as app.name for app in appType">
                            <option value="">--请选择--</option>
                        </select>
                    </div>
                </div>

                <div class="col-md-6">
                    <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>构建类型</label>
                    <div class="col-lg-8">
                        <!--required-->
                        <select class="form-control" ng-model="templateItem.ciType"
                                ng-options="ci.code as ci.name for ci in ciType">
                            <option value="">--请选择--</option>
                        </select>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <!--<div class="col-md-6">-->
                    <!--<label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>回滚类型</label>-->
                    <!--<div class="col-lg-8">-->
                        <!--&lt;!&ndash;required&ndash;&gt;-->
                        <!--<select class="form-control" ng-model="templateItem.rollbackType"-->
                                <!--ng-options="rollback.code as rollback.name for rollback in rollbackType">-->
                            <!--<option value="">&#45;&#45;请选择&#45;&#45;</option>-->
                        <!--</select>-->
                    <!--</div>-->
                <!--</div>-->

                <div class="col-md-6">
                    <label class="col-lg-4 control-label">环境类型</label>
                    <div class="col-lg-8">
                        <!--required-->
                        <select class="form-control" ng-model="templateItem.envType"
                                ng-options="env.code as env.name for env in envType">
                            <option value="">--请选择--</option>
                        </select>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-lg-2 control-label">说明</label>
                <div class="col-lg-10">
                            <textarea class="form-control" cols="2" placeholder="简短描述"
                                      ng-model="appItem.content"></textarea>
                </div>
            </div>

            <div class="form-group">
                <div style="text-align:center;">
                    <div style="text-align:center;">

                        <button ng-click="saveTemplate()"
                                class="btn btn-xs"
                                style="margin-left: 5px; background-color: #2e6da4; color: white;">
                            <span class="glyphicon glyphicon-ok"></span>保存
                        </button>

                        <!--<button ng-click="resetJob()"-->
                        <!--class="btn btn-xs"-->
                        <!--style="margin-left: 5px; background-color: #449d44; color: white;">-->
                        <!--<span class="glyphicon glyphicon-repeat"></span>重置-->
                        <!--</button>-->
                    </div>
                    <!--<span class="glyphicon glyphicon-save" ng-click="saveServerItem(insideip, publicip)"></span>-->
                    <!--<span class="glyphicon glyphicon-repeat" style="margin-left: 20px;" ng-click="resetServerItem()"></span>-->
                </div>
            </div>

            <div style="font-size:1em;">&nbsp;</div>
            <div class="form-group">
                <div style="text-align:center;" ng-show="todoDetail.todoStatus <= 0">
                    <!--保存-->
                    <button ng-click="saveTodo()"
                            class="btn btn-xs"
                            style="margin-left: 5px; background-color: #2e6da4; color: white;">
                        <span class="glyphicon glyphicon-ok"></span>保存
                    </button>
                </div>
            </div>

        </div>
    </form>

    <div ng-if="alert.type != ''">
        <div uib-alert ng-class="'alert-' + alert.type" close="closeAlert()">{{alert.msg}}</div>
    </div>
</div>